package cn.skyquant.quant4j.api.account;

import cn.skyquant.quant4j.api.enums.BorkerType;
import cn.skyquant.quant4j.sdk.enums.Status;

import java.io.Serializable;
import java.util.Objects;

public class AccountDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    public Integer id;
    public String parentCode;
    public String name;
    public String code;
    public BorkerType borkerType;
    public String borkerName;
    public String currency;
    public String type;
    public double balance;
    public double equity;
    public double usedMargin;
    public Status status;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AccountDTO)) return false;
        AccountDTO that = (AccountDTO) o;
        return Objects.equals(code, that.code) &&
                borkerType == that.borkerType;
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, borkerType);
    }

    @Override
    public String toString() {
        return "AccountDTO{" +
                "parentCode='" + parentCode + '\'' +
                ", name='" + name + '\'' +
                ", code='" + code + '\'' +
                ", borkerType=" + borkerType +
                ", borkerName='" + borkerName + '\'' +
                ", currency='" + currency + '\'' +
                ", type='" + type + '\'' +
                ", balance=" + balance +
                ", equity=" + equity +
                ", usedMargin=" + usedMargin +
                '}';
    }
}
